<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2018~2018 GoMaoMao [ http://www.gomaomao.com ]
// +----------------------------------------------------------------------
// | 官方网站: http://think.gomaomao.com
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | 联系方式：GoMaoMao <vip.vvm@qq.com>
// +----------------------------------------------------------------------
// | github开源项目：https://gitee.com/gomaomao.com/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\miniprogram\controller\api;

use controller\BasicApi;
use think\Db;

class Logs extends BasicApi
{
	public function view()
	{
		$_param                      = $this->param;
		$data                        = [];
		$data['open_id']             = $_param['open_id'];
		$data['app_id']              = $_param['appId'];
		$data['path']                = $_param['path'];
		$data['query']               = $_param['query'];
		$data['scene']               = $_param['scene'];
		$data['share_ticket']        = $_param['shareTicket'];
		$data['referrer_app_id']     = $_param['referrerAppId'];
		$data['referrer_extra_data'] = $_param['referrerExtraData'];
		$data['create_at']           = time();
		Db::name('logs_view')->strict(false)->insert($data);
		$this->_result([], 0, 'ok');
	}

	public function drive()
	{
		$_param            = $this->param;
		$data              = $_param['systemInfo'];
		$data['open_id']   = $_param['open_id'];
		$data['create_at'] = time();
		Db::name('logs_drive')->strict(false)->insert($data);
		$this->_result([], 0, 'ok');
	}
}
